package cn.wolfcode.service.impl;

import cn.wolfcode.domain.SystemDictionary;
import cn.wolfcode.mapper.SystemDictionaryMapper;
import cn.wolfcode.qo.QueryObject;
import cn.wolfcode.service.ISystemDictionaryService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SystemDictionaryServiceImpl implements ISystemDictionaryService {
    @Autowired
    private SystemDictionaryMapper systemDictionaryMapper;

    @Override
    public int insertSystemDictionary(SystemDictionary record) {
        systemDictionaryMapper.insert(record);
        return 0;
    }

    @Override
    public int deleteSystemDictionary(Long id) {
        systemDictionaryMapper.deleteByPrimaryKey(id);
        return 0;
    }

    @Override
    public int updateSystemDictionary(SystemDictionary record) {
        return systemDictionaryMapper.updateByPrimaryKey(record);
    }

    @Override
    public SystemDictionary selectSystemDictionary(Long id) {
        return systemDictionaryMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<SystemDictionary> selectSystemDictionaryList() {
        return systemDictionaryMapper.selectAll();
    }



    @Override
    public PageInfo<SystemDictionary> query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        return new PageInfo<SystemDictionary>(systemDictionaryMapper.queryList(qo));
    }
}
